Represents the version of the RESTful API distributed with ModeShape 2. It has been deprecated in ModeShape 3, but is still available using the v1 URL prefix. It provides the following methods:
1. Retrieve a list of available repositories
URL: http://<host>:<port>/<context>/v1/
HTTP Method: GET
Produces: application/json; text/html; text/plain;
Default Output: text/plain
Response Code (if successful): OK
Response Format:
{
"repo":
{
"repository":
{
"name": "repo",
"resources":
{
"workspaces": "/resources/v1/repo"
},
"metadata":
{
"option.retention.supported": "false",
"query.xpath.doc.order": "false",
...
}
}
}
}
2. Retrieve a list of workspaces for a repository
URL: http://<host>:<port>/<context>/v1/<repository_name>
HTTP Method: GET
Produces: application/json; text/html; text/plain;
Default Output: text/plain
Response Code (if successful): OK
Response Format:
{
"default":
{
"workspace":
{
"name": "default",
"resources":
{
"query": "/resources/v1/repo/default/query",
"items": "/resources/v1/repo/default/items"
}
}
}
}
3. Retrieve a node or a property
Retrieves an item at a given path.
URL: http://<host>:<port>/<context>/v1/<repository_name>/<workspace_name>/items/<item_path>
HTTP Method: GET
Produces: application/json; text/html; text/plain;
Default Output: text/plain
Response Code (if successful): OK
Optional Query Parameters:
Response Format:
{
"properties":
{
"jcr:primaryType": "mode:system"
},
"children":
[
"jcr:nodeTypes",
"jcr:versionStorage",
"mode:namespaces",
"mode:locks"
]
}
4. Create a node
Creates a node at the given path, using the body of request as JSON content
URL: http://<host>:<port>/<context>/v1/<repository_name>/<workspace_name>/items/<node_path>
HTTP Method: POST
Produces: application/json; text/html; text/plain;
Default Output: text/plain
Request Content-Type: accepts any, but for this to work it has to be a valid JSON object
Response Code (if successful): CREATED
Optional Query Parameters:
Request Format:
{ "properties":{
"jcr:primaryType":"nt:unstructured",
"testProperty":"testValue",
"multiValuedProperty":["value1", "value2"]
},
"children":{
"childNode":{
"properties":{
"nestedProperty":"nestedValue"
}
}
}
}
Response Format:
{"properties":{
"jcr:primaryType":"nt:unstructured",
"multiValuedProperty":["value1", "value2"],
"testProperty":"testValue"
}, "children":{
"childNode":{
"properties":{
"jcr:primaryType":"nt:unstructured",
"nestedProperty":"nestedValue"
}
}
}}
5. Update a node or a property
Updates a node or a property at the given path, using the body of request as JSON content
URL: http://<host>:<port>/<context>/v1/<repository_name>/<workspace_name>/items/<item_path>
HTTP Method: PUT
Produces: application/json; text/html; text/plain;
Default Output: text/plain
Request Content-Type: accepts any, but for this to work it has to be a valid JSON object
Response Code (if successful): OK
Request Format:
Node: same as the one used when creating
Property:
{"testProperty":"some_new_value"}
Response Format:
Node: same as one used when creating
Property:
{"testProperty":"some_new_value"}
6. Delete a node or a property
Deletes the node or the property at the given path.
URL: http://<host>:<port>/<context>/v1/<repository_name>/<workspace_name>/items/<item_path>
HTTP Method: DELETE
Produces: none
Response Code (if successful): OK
7. Execute a JCR query
Executes a JCR query in either: XPath, SQL or SQL2 format, returning a JSON object in response.
URL: http://<host>:<port>/<context>/v1/<repository_name>/<workspace_name>/query
HTTP Method: POST
Produces: application/json; text/html; text/plain;
Request Content-Type: application/jcr+sql; application/jcr+xpath; application/jcr+sql2; application/jcr+search
Default Output: text/plain
Response Code (if successful): OK
Optional Query Parameters:
Response Format:
{
"types":
{
"nt:base.jcr:primaryType": "STRING",
"nt:base.jcr:mixinTypes": "STRING",
"nt:base.jcr:path": "STRING",
"nt:base.jcr:name": "STRING",
"nt:base.jcr:score": "DOUBLE",
"nt:base.mode:localName": "STRING",
"nt:base.mode:depth": "LONG"
},
"rows":
[
{
"nt:base.jcr:primaryType": "mode:root",
"nt:base.jcr:path": "/",
"nt:base.jcr:name": "",
"nt:base.jcr:score": "0.3535533845424652",
"nt:base.mode:localName": "",
"nt:base.mode:depth": "0"
},
{
"nt:base.jcr:primaryType": "mode:locks",
"nt:base.jcr:path": "/jcr:system/mode:locks",
"nt:base.jcr:name": "mode:locks",
"nt:base.jcr:score": "0.3535533845424652",
"nt:base.mode:localName": "locks",
"nt:base.mode:depth": "2"
}
]
}